Skip to content

feat(webapp): add option to disable PostgreSQL task-event writes#4242

Merged
ericallam merged 3 commits into
mainfrom
feat/disable-postgres-task-event-writes
Jul 13, 2026
Merged

feat(webapp): add option to disable PostgreSQL task-event writes#4242
ericallam merged 3 commits into
mainfrom
feat/disable-postgres-task-event-writes

Conversation

@ericallam

Copy link
Copy Markdown
Member

Summary

Adds EVENT_REPOSITORY_POSTGRES_WRITES_DISABLED (default off), which makes the task-event store skip all PostgreSQL TaskEvent writes. It's for deployments that store task events in ClickHouse (EVENT_REPOSITORY_DEFAULT_STORE=clickhouse_v2) and no longer want the PostgreSQL copy.

How it works

The guard sits at the single postgres write boundary, TaskEventStore.create / createMany, so it covers every write path (OTLP ingestion and run-lifecycle events) with one check. Reads are untouched (findMany / trace queries / streaming), so existing PostgreSQL events remain readable.

Leave it off unless the default store is clickhouse_v2, otherwise task events for any run still routed to PostgreSQL would be dropped.

Adds EVENT_REPOSITORY_POSTGRES_WRITES_DISABLED (default off). When enabled, the
task-event store skips all PostgreSQL writes, for deployments that store task
events in ClickHouse (EVENT_REPOSITORY_DEFAULT_STORE=clickhouse_v2). Reads are
unaffected, so existing events stay readable.
@changeset-bot

changeset-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5168714

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ericallam ericallam marked this pull request as ready for review July 13, 2026 12:37
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 46b471d2-4f44-43ce-b785-6796319d5c41

📥 Commits

Reviewing files that changed from the base of the PR and between c46563a and 5168714.

📒 Files selected for processing (1)
  • apps/webapp/app/v3/eventRepository/eventRepository.server.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/webapp/app/v3/eventRepository/eventRepository.server.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (8)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (6, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (9, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (7, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (10, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (3, 10)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: code-quality / code-quality

Walkthrough

Adds the EVENT_REPOSITORY_POSTGRES_WRITES_DISABLED environment flag with a default value of false, documents its configuration and ClickHouse requirement, and updates event repository insert methods to skip PostgreSQL write scheduling and flushing when enabled.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary and behavior, but it misses the required issue link, checklist, testing steps, changelog, and screenshots sections. Add the template sections: Closes #issue, checklist items, testing steps, changelog, and screenshots, even if some are brief or not applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding an option to disable PostgreSQL task-event writes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/disable-postgres-task-event-writes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

…ository entry points

Guarding at TaskEventStore.createMany stopped the write but the repository still
buffered, reported success, and published Redis notifications for events that
were never persisted. Move the check to the insertMany/insertImmediate/
insertManyImmediate entry points so the postgres store is fully inert when
writes are disabled.
devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

…rtMany

The postgres-writes-disabled guard was bypassed: recordEvent and traceEvent fed
the flush scheduler directly for non-immediate events, so they still wrote to
PostgreSQL with the flag on. Route both through the guarded insertMany, making
it the only feeder of the flush scheduler.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Open in Devin Review

Comment thread apps/webapp/app/v3/eventRepository/eventRepository.server.ts
@ericallam ericallam merged commit 29598a7 into main Jul 13, 2026
57 of 62 checks passed
@ericallam ericallam deleted the feat/disable-postgres-task-event-writes branch July 13, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants